package com.example.driving.ui.user;


import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import com.example.driving.R;
import com.example.driving.base.BaseFragment;
import com.example.driving.databinding.FragmentSubjectBinding;


public class FindPasswordFragment extends BaseFragment<FragmentSubjectBinding> {

    private EditText editText;


    @Override
    public FragmentSubjectBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
        return null;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onBaseClick(View v) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View root = inflater.inflate(R.layout.fragment_find_password, container, false);
//        editText = root.findViewById(R.id.editText);
//        Button button = root.findViewById(R.id.button);
//        button.setOnClickListener(this::resetPasswordByEmail);
        return root;
    }

    private void resetPasswordByEmail(View view) {
        String email = editText.getText().toString();
        if (TextUtils.isEmpty(email)){
            editText.setError("邮箱不能为空");
            return;
        }
//        BmobUser.resetPasswordByEmail(email, new UpdateListener() {
//            @Override
//            public void done(BmobException e) {
//                if (e == null) {
//                    Snackbar.make(view, "重置密码请求成功，请到" + email + "邮箱进行密码重置操作", Snackbar.LENGTH_LONG).show();
//                    Navigation.findNavController(view).navigateUp();
//                } else {
//                    Log.e("BMOB", e.toString());
//                    Snackbar.make(view, "重置密码请求成功，请到" + email + "邮箱进行密码重置操作",
//                            Snackbar.LENGTH_LONG).show();
//                }
//            }
//        });
    }


}